package com.acwing.partition2;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/1/3 15:29
 */
public class AC170加成序列 {

    private static final int N = 110;
    private static int n = 0;
    private static final int[] path = new int[N];

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        path[0] = 1;
        while (true) {
            n = Integer.parseInt(reader.readLine());
            if (n == 0) break;
            int maxDepth = 1;
            while (!dfs(1, maxDepth)) maxDepth++;
            for (int i = 0; i < maxDepth; i++) writer.write(path[i] + " ");
            writer.write("\n");
        }
        writer.flush();
    }

    private static boolean dfs(int depth, int maxDepth) {
        if (depth > maxDepth) return false;
        if (path[depth - 1] == n) return true;
        boolean[] visited = new boolean[N];
        for (int i = depth - 1; i >= 0; i--) {
            for (int j = i; j >= 0; j--) {
                int sum = path[i] + path[j];
                if (sum > n || sum <= path[depth - 1] || visited[sum]) continue;
                visited[sum] = true;
                path[depth] = sum;
                if (dfs(depth + 1, maxDepth)) return true;
            }
        }
        return false;
    }
}
